package uscdb.model;

import java.sql.Clob;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

@Entity
@Table(name = "tscript")
@DynamicInsert(true)
@DynamicUpdate(true)
public class Tscript implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1887968923930168998L;
	private String id;
	/**
	 * 用例编号 testcase ID
	 */
	private String sid;

	/**
	 * 用例名称
	 */
	private String name;
	/**
	 * 用例number
	 */
	private String testcaseNumber;
	/**
	 * 该用户的总review数
	 */
	private Integer totalFailNum = 0;

	/**
	 * 用例对应的版本
	 */
	private Tversion tversion;

	/**
	 * 问题解决的状态：已解决、未解决、定位中、已提单
	 */
	private String solveType;
	/**
	 * 脚本的备注
	 */
	private Clob note;

	@Id
	@Column(name = "ID", nullable = false, length = 36)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "sid", length = 100)
	public String getSid() {
		return sid;
	}

	public void setSid(String sid) {
		this.sid = sid;
	}

	@Column(name = "name", length = 300)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "totalFailNum")
	public Integer getTotalFailNum() {
		return totalFailNum;
	}

	public void setTotalFailNum(Integer totalFailNum) {
		this.totalFailNum = totalFailNum;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TVERSION_ID")
	public Tversion getTversion() {
		return tversion;
	}

	public void setTversion(Tversion tversion) {
		this.tversion = tversion;
	}

	@Column(name = "testcaseNumber", length = 100)
	public String getTestcaseNumber() {
		return testcaseNumber;
	}

	public void setTestcaseNumber(String testcaseNumber) {
		this.testcaseNumber = testcaseNumber;
	}

	@Override
	public String toString() {
		return "Tscript [id=" + id + ", sid=" + sid + ", name=" + name + ", testcaseNumber=" + testcaseNumber
				+ ", totalFailNum=" + totalFailNum + "]";
	}

	public Tscript(String id, String name, String testcaseNumber, Integer totalFailNum, Tversion tversion) {
		super();
		this.id = id;
		this.name = name;
		this.testcaseNumber = testcaseNumber;
		this.totalFailNum = totalFailNum;
		this.tversion = tversion;
	}

	public Tscript() {
		super();
	}

	@Column(name = "solveType")
	public String getSolveType() {
		return solveType;
	}

	public void setSolveType(String solveType) {
		this.solveType = solveType;
	}

	@Column(name = "note")
	public Clob getNote() {
		return note;
	}

	public void setNote(Clob note) {
		this.note = note;
	}

}
